﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EzDesk.Core.ServiceImpl.Services
{
    public class FeedTypeDictionary
    {
        private static readonly Dictionary<string, int> FeedTypeDic =
            new Dictionary<string, int>
                {
                    {"update", 0},
                    {"notification", 1},
                    {"todo", 2},
                };


        public static List<string> AllFeedTypes()
        {
            return FeedTypeDic.Keys.ToList();
        }

        public static int StringToIntType(string feedTypeStr)
        {
            int result = -1;

            if (feedTypeStr != null && FeedTypeDic.ContainsKey(feedTypeStr))
            {
                result = FeedTypeDic[feedTypeStr];
            }

            return result;
        }

        public static string IntTypeToString(int value)
        {
            var item = FeedTypeDic.Where(p => p.Value == value);
            return item.Count() > 0 ? item.First().Key : null;
        }
    }
}
